class Calculator {  
  def calculate(num1: Int, num2: Int, operator: String): Any = {  
    operator match {  
      case "+" => num1 + num2  
      case "-" => num1 - num2  
      case "*" => num1 * num2  
      case "/" =>  
        if (num2 == 0) "Cannot divide by zero"  
        else num1 / num2  
      case _ => "Invalid operator"  
    }  
  }  
}  
  
object Main {  
  def main(args: Array[String]): Unit = {  
    val calculator = new Calculator()  
    println(calculator.calculate(5, 3, "+"))  
    println(calculator.calculate(5, 3, "-"))  
    println(calculator.calculate(5, 3, "*"))  
    println(calculator.calculate(5, 3, "/"))  
    println(calculator.calculate(5, 0, "/"))  
    println(calculator.calculate(5, 3, "^"))  
  }  
}
